package com.gp.billsrecord.model.data

import androidx.room.Entity
import androidx.room.PrimaryKey
import com.gp.billsrecord.base.IComparator

/**
 * 账户信息
 *
 */
@Entity(tableName = "tbl_account", primaryKeys = ["accountId", "userId"])
data class AccountInfo(
    val accountId: Long,
    val accountNumber: String,
    val accountTypeId: Long,
    val accountTypeName: String,
    /**
     * 创建时间
     */
    val createTime: Long,
    /**
     * 余额 以分为单位
     */
    val balance: Long,
    val userId: Long
) : IComparator<AccountInfo> {
    override fun areItemsTheSame(newItem: AccountInfo): Boolean = accountId == newItem.accountId

    override fun areContentsTheSame(newItem: AccountInfo): Boolean = accountId == newItem.accountId
}

/**
 * 账户类型
 */
@Entity(tableName = "tbl_account_type")
data class AccountType(
    /**
     * 类型ID
     */
    @PrimaryKey
    val typeId: Long,
    /**
     * 类型名称
     */
    val typeName: String,
    val userId: Long = 0L
) {
    override fun toString(): String = typeName
}
